package com.lst.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.lst.base.entity.BaseRequest;
import com.lst.base.entity.BaseResponse;
import com.lst.common.CommCode;
import com.lst.dao.ClientOnlineCourseMapper;
import com.lst.entity.request.OnlineCourseListReqPara;
import com.lst.entity.response.CourseListResPara;
import com.lst.entity.response.OnlineCourseListResPara;
import com.lst.model.ClientOnlineCourse;
import com.lst.model.CourseClass;
import com.lst.model.OnlineCourse;
import com.lst.service.OnlineCourseService;
import com.lst.utils.RequestUtils;
/**
 * 
 * @ClassName: 功夫二级分类
 * @Description: 
 * @author zmm
 * @date 2018年3月15日下午2:30:34
 *
 */
public class CourseListServlet extends BaseServlet {

    private static final long serialVersionUID = 1L;

    private OnlineCourseService onlineCourseService = ctx.getBean(OnlineCourseService.class);
    
    @Autowired
    private ClientOnlineCourseMapper clientOnlineCourseMapper = ctx.getBean(ClientOnlineCourseMapper.class);

    public void doGet(HttpServletRequest request, HttpServletResponse response)
	    throws ServletException, IOException {

	doPost(request, response);
    }

    public void doPost(HttpServletRequest request, HttpServletResponse response)
	    throws ServletException, IOException {

	CourseListResPara resPara = new CourseListResPara();
	try {
		OnlineCourseListReqPara reqPara = getReqPara(request);

	   Integer userid = Integer.valueOf(reqPara.getUserid());
	    Integer classId = Integer.valueOf(reqPara.getClassId());
	    List<CourseClass> courseClassList=new ArrayList<CourseClass>();
	    if(classId==1){
	    	 Map<String,Object> map=new HashMap<String,Object>();
	 	     map.put("type", CommCode.Course_Class1);
	 	     map.put("reserved2", CommCode.Course_Class_type1);
	 	     List<OnlineCourse> courseList=onlineCourseService.queryList2(map);
	 	     //判断是否添加到我的功夫
	 	     if(courseList!=null&&courseList.size()>0){
	 	    	 for(OnlineCourse onlineCourse:courseList){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass=new  CourseClass();
	 	     courseClass.setClassName("心肺能量激活");
	 	     courseClass.setCourseList(courseList);
	 	     courseClassList.add(courseClass);
	 	     
	 	    Map<String,Object> map2=new HashMap<String,Object>();
	 	     map2.put("type", CommCode.Course_Class1);
	 	     map2.put("reserved2", CommCode.Course_Class_type2);
	 	     List<OnlineCourse> courseList2=onlineCourseService.queryList2(map2);
	 	     //判断是否添加到我的功夫
	 	     if(courseList2!=null&&courseList2.size()>0){
	 	    	 for(OnlineCourse onlineCourse2:courseList2){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse2.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse2.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass2=new  CourseClass();
	 	     courseClass2.setClassName("体能快充");
	 	     courseClass2.setCourseList(courseList2);
	 	     courseClassList.add(courseClass2);
	 	     
	 	    Map<String,Object> map3=new HashMap<String,Object>();
	 	     map3.put("type", CommCode.Course_Class1);
	 	     map3.put("reserved2", CommCode.Course_Class_type3);
	 	     List<OnlineCourse> courseList3=onlineCourseService.queryList2(map3);
	 	     //判断是否添加到我的功夫
	 	     if(courseList3!=null&&courseList3.size()>0){
	 	    	 for(OnlineCourse onlineCourse3:courseList3){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse3.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse3.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass3=new  CourseClass();
	 	     courseClass3.setClassName("肌肉唤醒");
	 	     courseClass3.setCourseList(courseList3);
	 	     courseClassList.add(courseClass3);
	 	     
	    }
	    if(classId==2){
	    	 Map<String,Object> map=new HashMap<String,Object>();
	    	 map.put("type", CommCode.Course_Class2);
	 	     map.put("reserved2", CommCode.Course_Class_type4);
	 	     List<OnlineCourse> courseList=onlineCourseService.queryList2(map);
	 	    //判断是否添加到我的功夫
	 	     if(courseList!=null&&courseList.size()>0){
	 	    	 for(OnlineCourse onlineCourse:courseList){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     CourseClass courseClass=new  CourseClass();
	 	     courseClass.setClassName("专项稳定特训");
	 	     courseClass.setCourseList(courseList);
	 	     courseClassList.add(courseClass);
	 	     
	 	    Map<String,Object> map2=new HashMap<String,Object>();
	    	 map2.put("type", CommCode.Course_Class2);
	 	     map2.put("reserved2", CommCode.Course_Class_type5);
	 	     List<OnlineCourse> courseList2=onlineCourseService.queryList2(map2);
	 	    //判断是否添加到我的功夫
	 	     if(courseList2!=null&&courseList2.size()>0){
	 	    	 for(OnlineCourse onlineCourse2:courseList2){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse2.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse2.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     CourseClass courseClass2=new  CourseClass();
	 	     courseClass2.setClassName("专项力量特训");
	 	     courseClass2.setCourseList(courseList2);
	 	     courseClassList.add(courseClass2);
	 	     
	 	     
	 	    Map<String,Object> map3=new HashMap<String,Object>();
	    	 map3.put("type", CommCode.Course_Class2);
	 	     map3.put("reserved2", CommCode.Course_Class_type6);
	 	     List<OnlineCourse> courseList3=onlineCourseService.queryList2(map3);
	 	    //判断是否添加到我的功夫
	 	     if(courseList3!=null&&courseList3.size()>0){
	 	    	 for(OnlineCourse onlineCourse3:courseList3){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse3.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse3.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass3=new  CourseClass();
	 	     courseClass3.setClassName("专项反应能力特训");
	 	     courseClass3.setCourseList(courseList3);
	 	     courseClassList.add(courseClass3);
	 	     
	    }
	    if(classId==3){
	    	 Map<String,Object> map=new HashMap<String,Object>();
	    	 map.put("type", CommCode.Course_Class3);
	 	     map.put("reserved2", CommCode.Course_Class_type7);
	 	     List<OnlineCourse> courseList=onlineCourseService.queryList2(map);
	 	    //判断是否添加到我的功夫
	 	     if(courseList!=null&&courseList.size()>0){
	 	    	 for(OnlineCourse onlineCourse:courseList){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     CourseClass courseClass=new  CourseClass();
	 	     courseClass.setClassName("拳法表现训练 ");
	 	     courseClass.setCourseList(courseList);
	 	     courseClassList.add(courseClass);
	 	     
	 	    Map<String,Object> map2=new HashMap<String,Object>();
	    	 map2.put("type", CommCode.Course_Class3);
	 	     map2.put("reserved2", CommCode.Course_Class_type8);
	 	     List<OnlineCourse> courseList2=onlineCourseService.queryList2(map2);
	 	    //判断是否添加到我的功夫
	 	     if(courseList2!=null&&courseList2.size()>0){
	 	    	 for(OnlineCourse onlineCourse2:courseList2){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse2.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse2.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     CourseClass courseClass2=new  CourseClass();
	 	     courseClass2.setClassName("踢击表现训练 ");
	 	     courseClass2.setCourseList(courseList2);
	 	     courseClassList.add(courseClass2);
	 	     
		 	    Map<String,Object> map3=new HashMap<String,Object>();
		    	 map3.put("type", CommCode.Course_Class3);
		 	     map3.put("reserved2", CommCode.Course_Class_type9);
		 	     List<OnlineCourse> courseList3=onlineCourseService.queryList2(map3);
		 	    //判断是否添加到我的功夫
		 	     if(courseList3!=null&&courseList3.size()>0){
		 	    	 for(OnlineCourse onlineCourse3:courseList3){
		 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
		 	   		    reqmap.put("clientid", userid);
		 	   		    reqmap.put("courseid", onlineCourse3.getId());
		 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
		 	   		    if(clientOnlineCourse!=null){
		 	   		    onlineCourse3.setIsAdd(true);
		 	   		    }
		 	    	 }
		 	     }
		 	     CourseClass courseClass3=new  CourseClass();
		 	     courseClass3.setClassName("地面表现训练 ");
		 	     courseClass3.setCourseList(courseList3);
		 	     courseClassList.add(courseClass3);
	 	     
	    }
	    if(classId==4){
	    	 Map<String,Object> map=new HashMap<String,Object>();
	 	     map.put("type", CommCode.Course_Class8);
	 	     map.put("reserved2", CommCode.Course_Class_type10);
	 	     List<OnlineCourse> courseList=onlineCourseService.queryList2(map);
	 	     
	 	    //判断是否添加到我的功夫
	 	     if(courseList!=null&&courseList.size()>0){
	 	    	 for(OnlineCourse onlineCourse:courseList){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass=new  CourseClass();
	 	     courseClass.setClassName("拳法初级特训 ");
	 	     courseClass.setCourseList(courseList);
	 	     courseClassList.add(courseClass);
	 	     
	 	  	 Map<String,Object> map2=new HashMap<String,Object>();
	 	     map2.put("type", CommCode.Course_Class8);
	 	     map2.put("reserved2", CommCode.Course_Class_type11);
	 	     List<OnlineCourse> courseList2=onlineCourseService.queryList2(map2);
	 	     
	 	    //判断是否添加到我的功夫
	 	     if(courseList2!=null&&courseList2.size()>0){
	 	    	 for(OnlineCourse onlineCourse2:courseList2){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse2.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse2=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse2!=null){
	 	   		    onlineCourse2.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass2=new  CourseClass();
	 	     courseClass2.setClassName("拳法高级特训 ");
	 	     courseClass2.setCourseList(courseList2);
	 	     courseClassList.add(courseClass2);
	 	     
	 	  	 Map<String,Object> map3=new HashMap<String,Object>();
	 	     map3.put("type", CommCode.Course_Class8);
	 	     map3.put("reserved2", CommCode.Course_Class_type12);
	 	     List<OnlineCourse> courseList3=onlineCourseService.queryList2(map3);
	 	     
	 	    //判断是否添加到我的功夫
	 	     if(courseList3!=null&&courseList3.size()>0){
	 	    	 for(OnlineCourse onlineCourse3:courseList3){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse3.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse3=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse3!=null){
	 	   		    onlineCourse3.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass3=new  CourseClass();
	 	     courseClass3.setClassName("拳法专项能力特训 ");
	 	     courseClass3.setCourseList(courseList3);
	 	     courseClassList.add(courseClass3);
	    }
	    if(classId==5){
	    	 Map<String,Object> map=new HashMap<String,Object>();
	 	     map.put("type", CommCode.Course_Class9);
	 	     map.put("reserved2", CommCode.Course_Class_type13);
	 	     List<OnlineCourse> courseList=onlineCourseService.queryList2(map);
	 	     
	 	    //判断是否添加到我的功夫
	 	     if(courseList!=null&&courseList.size()>0){
	 	    	 for(OnlineCourse onlineCourse:courseList){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass=new  CourseClass();
	 	     courseClass.setClassName("踢击初级特训 ");
	 	     courseClass.setCourseList(courseList);
	 	     courseClassList.add(courseClass);
	 	     
	 	  	 Map<String,Object> map2=new HashMap<String,Object>();
	 	     map2.put("type", CommCode.Course_Class9);
	 	     map2.put("reserved2", CommCode.Course_Class_type14);
	 	     List<OnlineCourse> courseList2=onlineCourseService.queryList2(map2);
	 	     
	  	    //判断是否添加到我的功夫
	 	     if(courseList2!=null&&courseList2.size()>0){
	 	    	 for(OnlineCourse onlineCourse2:courseList2){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse2.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse2=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse2!=null){
	 	   		    onlineCourse2.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass2=new  CourseClass();
	 	     courseClass2.setClassName("踢击高级特训 ");
	 	     courseClass2.setCourseList(courseList2);
	 	     courseClassList.add(courseClass2);
	 	     
	 	  	 Map<String,Object> map3=new HashMap<String,Object>();
	 	     map3.put("type", CommCode.Course_Class9);
	 	     map3.put("reserved2", CommCode.Course_Class_type15);
	 	     List<OnlineCourse> courseList3=onlineCourseService.queryList2(map3);
	 	     
	 	    //判断是否添加到我的功夫
	 	     if(courseList3!=null&&courseList3.size()>0){
	 	    	 for(OnlineCourse onlineCourse3:courseList3){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse3.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse3=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse3!=null){
	 	   		    onlineCourse3.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass3=new  CourseClass();
	 	     courseClass3.setClassName("踢击专项能力特训 ");
	 	     courseClass3.setCourseList(courseList3);
	 	     courseClassList.add(courseClass3);
	    }
	    
	    if(classId==6){
	    	 Map<String,Object> map=new HashMap<String,Object>();
	 	     map.put("type", CommCode.Course_Class10);
	 	     map.put("reserved2", CommCode.Course_Class_type16);
	 	     List<OnlineCourse> courseList=onlineCourseService.queryList2(map);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList!=null&&courseList.size()>0){
	 	    	 for(OnlineCourse onlineCourse:courseList){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass=new  CourseClass();
	 	     courseClass.setClassName("摔投技与寝技特训 ");
	 	     courseClass.setCourseList(courseList);
	 	     courseClassList.add(courseClass);
 	     
	 	  	 Map<String,Object> map2=new HashMap<String,Object>();
	 	     map2.put("type", CommCode.Course_Class10);
	 	     map2.put("reserved2", CommCode.Course_Class_type18);
	 	     List<OnlineCourse> courseList2=onlineCourseService.queryList2(map2);
	 	     
		  	    //判断是否添加到我的功夫
		 	 if(courseList2!=null&&courseList2.size()>0){
		 	    	 for(OnlineCourse onlineCourse2:courseList2){
		 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
		 	   		    reqmap.put("clientid", userid);
		 	   		    reqmap.put("courseid", onlineCourse2.getId());
		 	   		    ClientOnlineCourse clientOnlineCourse2=clientOnlineCourseMapper.selectByMap(reqmap);
		 	   		    if(clientOnlineCourse2!=null){
		 	   		    onlineCourse2.setIsAdd(true);
		 	   		    }
		 	    	 }
		 	     }
	 	     
	 	     CourseClass courseClass2=new  CourseClass();
	 	     courseClass2.setClassName("地面专项能力特训 ");
	 	     courseClass2.setCourseList(courseList2);
	 	     courseClassList.add(courseClass2);
	 	     
	 	  	 Map<String,Object> map3=new HashMap<String,Object>();
	 	     map3.put("type", CommCode.Course_Class10);
	 	     map3.put("reserved2", CommCode.Course_Class_type17);
	 	     List<OnlineCourse> courseList3=onlineCourseService.queryList2(map3);
	 	     
	 	    //判断是否添加到我的功夫
	 	     if(courseList3!=null&&courseList3.size()>0){
	 	    	 for(OnlineCourse onlineCourse3:courseList3){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse3.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse3=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse3!=null){
	 	   		    onlineCourse3.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass3=new  CourseClass();
	 	     courseClass3.setClassName("地面击打特训 ");
	 	     courseClass3.setCourseList(courseList3);
	 	     courseClassList.add(courseClass3);
	 	     
//	 		 Map<String,Object> map4=new HashMap<String,Object>();
//	 	     map4.put("type", CommCode.Course_Class10);
//	 	     map4.put("reserved2", CommCode.Course_Class_type11);
//	 	     List<OnlineCourse> courseList4=onlineCourseService.queryList2(map4);
//	 	     
//	 	    //判断是否添加到我的功夫
//	 	     if(courseList4!=null&&courseList4.size()>0){
//	 	    	 for(OnlineCourse onlineCourse4:courseList4){
//	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
//	 	   		    reqmap.put("clientid", userid);
//	 	   		    reqmap.put("courseid", onlineCourse4.getId());
//	 	   		    ClientOnlineCourse clientOnlineCourse4=clientOnlineCourseMapper.selectByMap(reqmap);
//	 	   		    if(clientOnlineCourse4!=null){
//	 	   		    onlineCourse4.setIsAdd(true);
//	 	   		    }
//	 	    	 }
//	 	     }
//	 	     
//	 	     CourseClass courseClass4=new  CourseClass();
//	 	     courseClass4.setClassName("地面阻力训练 ");
//	 	     courseClass4.setCourseList(courseList4);
//	 	     courseClassList.add(courseClass4);
	    }
	    
	    if(classId==7){
	    	 Map<String,Object> map=new HashMap<String,Object>();
	 	     map.put("type", CommCode.Course_Class11);
	 	     map.put("reserved2", CommCode.Course_Class_type20);
	 	     List<OnlineCourse> courseList=onlineCourseService.queryList2(map);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList!=null&&courseList.size()>0){
	 	    	 for(OnlineCourse onlineCourse:courseList){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass=new  CourseClass();
	 	     courseClass.setClassName("拳腿组合特训 ");
	 	     courseClass.setCourseList(courseList);
	 	     courseClassList.add(courseClass);
	 	     
	 	  	 Map<String,Object> map2=new HashMap<String,Object>();
	 	     map2.put("type", CommCode.Course_Class11);
	 	     map2.put("reserved2", CommCode.Course_Class_type21);
	 	     List<OnlineCourse> courseList2=onlineCourseService.queryList2(map2);
	 	     
		  	    //判断是否添加到我的功夫
		 	 if(courseList2!=null&&courseList2.size()>0){
		 	    	 for(OnlineCourse onlineCourse2:courseList2){
		 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
		 	   		    reqmap.put("clientid", userid);
		 	   		    reqmap.put("courseid", onlineCourse2.getId());
		 	   		    ClientOnlineCourse clientOnlineCourse2=clientOnlineCourseMapper.selectByMap(reqmap);
		 	   		    if(clientOnlineCourse2!=null){
		 	   		    onlineCourse2.setIsAdd(true);
		 	   		    }
		 	    	 }
		 	     }
	 	     
	 	     CourseClass courseClass2=new  CourseClass();
	 	     courseClass2.setClassName("功夫综合特训 ");
	 	     courseClass2.setCourseList(courseList2);
	 	     courseClassList.add(courseClass2);
	 	     
	 	  	 Map<String,Object> map3=new HashMap<String,Object>();
	 	     map3.put("type", CommCode.Course_Class11);
	 	     map3.put("reserved2", CommCode.Course_Class_type19);
	 	     List<OnlineCourse> courseList3=onlineCourseService.queryList2(map3);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList3!=null&&courseList3.size()>0){
	 	    	 for(OnlineCourse onlineCourse3:courseList3){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse3.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse3=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse3!=null){
	 	   		    onlineCourse3.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass3=new  CourseClass();
	 	     courseClass3.setClassName("专项综合能力特训 ");
	 	     courseClass3.setCourseList(courseList3);
	 	     courseClassList.add(courseClass3);
	    }
	    
	    if(classId==8){
	    	 Map<String,Object> map=new HashMap<String,Object>();
	 	     map.put("type", CommCode.Course_Class12);
	 	     map.put("reserved2", CommCode.Course_Class_type22);
	 	     List<OnlineCourse> courseList=onlineCourseService.queryList2(map);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList!=null&&courseList.size()>0){
	 	    	 for(OnlineCourse onlineCourse:courseList){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass=new  CourseClass();
	 	     courseClass.setClassName("防守特训 ");
	 	     courseClass.setCourseList(courseList);
	 	     courseClassList.add(courseClass);
	 	     
//	 	  	 Map<String,Object> map2=new HashMap<String,Object>();
//	 	     map2.put("type", CommCode.Course_Class12);
//	 	     map2.put("reserved2", CommCode.Course_Class_type16);
//	 	     List<OnlineCourse> courseList2=onlineCourseService.queryList2(map2);
//	 	     
//		  	    //判断是否添加到我的功夫
//		 	 if(courseList2!=null&&courseList2.size()>0){
//		 	    	 for(OnlineCourse onlineCourse2:courseList2){
//		 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
//		 	   		    reqmap.put("clientid", userid);
//		 	   		    reqmap.put("courseid", onlineCourse2.getId());
//		 	   		    ClientOnlineCourse clientOnlineCourse2=clientOnlineCourseMapper.selectByMap(reqmap);
//		 	   		    if(clientOnlineCourse2!=null){
//		 	   		    onlineCourse2.setIsAdd(true);
//		 	   		    }
//		 	    	 }
//		 	     }
//	 	     
//	 	     CourseClass courseClass2=new  CourseClass();
//	 	     courseClass2.setClassName("闪躲特训 ");
//	 	     courseClass2.setCourseList(courseList2);
//	 	     courseClassList.add(courseClass2);
	 	     
	 	  	 Map<String,Object> map3=new HashMap<String,Object>();
	 	     map3.put("type", CommCode.Course_Class12);
	 	     map3.put("reserved2", CommCode.Course_Class_type23);
	 	     List<OnlineCourse> courseList3=onlineCourseService.queryList2(map3);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList3!=null&&courseList3.size()>0){
	 	    	 for(OnlineCourse onlineCourse3:courseList3){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse3.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse3=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse3!=null){
	 	   		    onlineCourse3.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass3=new  CourseClass();
	 	     courseClass3.setClassName("抗击打特训 ");
	 	     courseClass3.setCourseList(courseList3);
	 	     courseClassList.add(courseClass3);
	    }
	    
	    if(classId==9){
	    	 Map<String,Object> map=new HashMap<String,Object>();
	 	     map.put("type", CommCode.Course_Class13);
	 	     map.put("reserved2", CommCode.Course_Class_type24);
	 	     List<OnlineCourse> courseList=onlineCourseService.queryList2(map);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList!=null&&courseList.size()>0){
	 	    	 for(OnlineCourse onlineCourse:courseList){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass=new  CourseClass();
	 	     courseClass.setClassName("柔韧训练 ");
	 	     courseClass.setCourseList(courseList);
	 	     courseClassList.add(courseClass);
	 	     
	 	  	 Map<String,Object> map2=new HashMap<String,Object>();
	 	     map2.put("type", CommCode.Course_Class13);
	 	     map2.put("reserved2", CommCode.Course_Class_type25);
	 	     List<OnlineCourse> courseList2=onlineCourseService.queryList2(map2);
	 	     
		  	    //判断是否添加到我的功夫
		 	 if(courseList2!=null&&courseList2.size()>0){
		 	    	 for(OnlineCourse onlineCourse2:courseList2){
		 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
		 	   		    reqmap.put("clientid", userid);
		 	   		    reqmap.put("courseid", onlineCourse2.getId());
		 	   		    ClientOnlineCourse clientOnlineCourse2=clientOnlineCourseMapper.selectByMap(reqmap);
		 	   		    if(clientOnlineCourse2!=null){
		 	   		    onlineCourse2.setIsAdd(true);
		 	   		    }
		 	    	 }
		 	     }
	 	     
	 	     CourseClass courseClass2=new  CourseClass();
	 	     courseClass2.setClassName("平衡训练 ");
	 	     courseClass2.setCourseList(courseList2);
	 	     courseClassList.add(courseClass2);
	 	     
	 	  	 Map<String,Object> map3=new HashMap<String,Object>();
	 	     map3.put("type", CommCode.Course_Class13);
	 	     map3.put("reserved2", CommCode.Course_Class_type26);
	 	     List<OnlineCourse> courseList3=onlineCourseService.queryList2(map3);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList3!=null&&courseList3.size()>0){
	 	    	 for(OnlineCourse onlineCourse3:courseList3){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse3.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse3=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse3!=null){
	 	   		    onlineCourse3.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass3=new  CourseClass();
	 	     courseClass3.setClassName("稳定训练 ");
	 	     courseClass3.setCourseList(courseList3);
	 	     courseClassList.add(courseClass3);
	    }
	    
	    if(classId==10){
	    	 Map<String,Object> map=new HashMap<String,Object>();
	 	     map.put("type", CommCode.Course_Class14);
	 	     map.put("reserved2", CommCode.Course_Class_type27);
	 	     List<OnlineCourse> courseList=onlineCourseService.queryList2(map);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList!=null&&courseList.size()>0){
	 	    	 for(OnlineCourse onlineCourse:courseList){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass=new  CourseClass();
	 	     courseClass.setClassName("力量基础 ");
	 	     courseClass.setCourseList(courseList);
	 	     courseClassList.add(courseClass);
	 	     
	 	  	 Map<String,Object> map2=new HashMap<String,Object>();
	 	     map2.put("type", CommCode.Course_Class14);
	 	     map2.put("reserved2", CommCode.Course_Class_type28);
	 	     List<OnlineCourse> courseList2=onlineCourseService.queryList2(map2);
	 	     
		  	    //判断是否添加到我的功夫
		 	 if(courseList2!=null&&courseList2.size()>0){
		 	    	 for(OnlineCourse onlineCourse2:courseList2){
		 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
		 	   		    reqmap.put("clientid", userid);
		 	   		    reqmap.put("courseid", onlineCourse2.getId());
		 	   		    ClientOnlineCourse clientOnlineCourse2=clientOnlineCourseMapper.selectByMap(reqmap);
		 	   		    if(clientOnlineCourse2!=null){
		 	   		    onlineCourse2.setIsAdd(true);
		 	   		    }
		 	    	 }
		 	     }
		 	 
	 	     CourseClass courseClass2=new  CourseClass();
	 	     courseClass2.setClassName("力量耐力 ");
	 	     courseClass2.setCourseList(courseList2);
	 	     courseClassList.add(courseClass2);
	 	     
	 	  	 Map<String,Object> map3=new HashMap<String,Object>();
	 	     map3.put("type", CommCode.Course_Class14);
	 	     map3.put("reserved2", CommCode.Course_Class_type29);
	 	     List<OnlineCourse> courseList3=onlineCourseService.queryList2(map3);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList3!=null&&courseList3.size()>0){
	 	    	 for(OnlineCourse onlineCourse3:courseList3){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse3.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse3=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse3!=null){
	 	   		    onlineCourse3.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass3=new  CourseClass();
	 	     courseClass3.setClassName("爆发力 ");
	 	     courseClass3.setCourseList(courseList3);
	 	     courseClassList.add(courseClass3);
	 	     
	 	     Map<String,Object> map4=new HashMap<String,Object>();
	 	     map4.put("type", CommCode.Course_Class14);
	 	     map4.put("reserved2", CommCode.Course_Class_type44);
	 	     List<OnlineCourse> courseList4=onlineCourseService.queryList2(map4);
	 	     
		  	    //判断是否添加到我的功夫
		 	 if(courseList4!=null&&courseList4.size()>0){
		 	    	 for(OnlineCourse onlineCourse4:courseList4){
		 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
		 	   		    reqmap.put("clientid", userid);
		 	   		    reqmap.put("courseid", onlineCourse4.getId());
		 	   		    ClientOnlineCourse clientOnlineCourse4=clientOnlineCourseMapper.selectByMap(reqmap);
		 	   		    if(clientOnlineCourse4!=null){
		 	   		    onlineCourse4.setIsAdd(true);
		 	   		    }
		 	    	 }
		 	     }
		 	 
	 	     CourseClass courseClass4=new  CourseClass();
	 	     courseClass4.setClassName("综合力量");
	 	     courseClass4.setCourseList(courseList4);
	 	     courseClassList.add(courseClass4);
	    }
	    
	    if(classId==11){
	    	 Map<String,Object> map=new HashMap<String,Object>();
	 	     map.put("type", CommCode.Course_Class15);
	 	     map.put("reserved2", CommCode.Course_Class_type30);
	 	     List<OnlineCourse> courseList=onlineCourseService.queryList2(map);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList!=null&&courseList.size()>0){
	 	    	 for(OnlineCourse onlineCourse:courseList){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass=new  CourseClass();
	 	     courseClass.setClassName("移动能力 ");
	 	     courseClass.setCourseList(courseList);
	 	     courseClassList.add(courseClass);
	 	     
	 	  	 Map<String,Object> map2=new HashMap<String,Object>();
	 	     map2.put("type", CommCode.Course_Class15);
	 	     map2.put("reserved2", CommCode.Course_Class_type31);
	 	     List<OnlineCourse> courseList2=onlineCourseService.queryList2(map2);
	 	     
		  	    //判断是否添加到我的功夫
		 	 if(courseList2!=null&&courseList2.size()>0){
		 	    	 for(OnlineCourse onlineCourse2:courseList2){
		 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
		 	   		    reqmap.put("clientid", userid);
		 	   		    reqmap.put("courseid", onlineCourse2.getId());
		 	   		    ClientOnlineCourse clientOnlineCourse2=clientOnlineCourseMapper.selectByMap(reqmap);
		 	   		    if(clientOnlineCourse2!=null){
		 	   		    onlineCourse2.setIsAdd(true);
		 	   		    }
		 	    	 }
		 	     }
		 	 
	 	     CourseClass courseClass2=new  CourseClass();
	 	     courseClass2.setClassName("功夫步法 ");
	 	     courseClass2.setCourseList(courseList2);
	 	     courseClassList.add(courseClass2);
	 	     
	 	  	 Map<String,Object> map3=new HashMap<String,Object>();
	 	     map3.put("type", CommCode.Course_Class15);
	 	     map3.put("reserved2", CommCode.Course_Class_type32);
	 	     List<OnlineCourse> courseList3=onlineCourseService.queryList2(map3);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList3!=null&&courseList3.size()>0){
	 	    	 for(OnlineCourse onlineCourse3:courseList3){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse3.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse3=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse3!=null){
	 	   		    onlineCourse3.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass3=new  CourseClass();
	 	     courseClass3.setClassName("转换能力训练 ");
	 	     courseClass3.setCourseList(courseList3);
	 	     courseClassList.add(courseClass3);
	    }
	    
	    if(classId==12){
	    	 Map<String,Object> map=new HashMap<String,Object>();
	 	     map.put("type", CommCode.Course_Class16);
	 	     map.put("reserved2", CommCode.Course_Class_type33);
	 	     List<OnlineCourse> courseList=onlineCourseService.queryList2(map);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList!=null&&courseList.size()>0){
	 	    	 for(OnlineCourse onlineCourse:courseList){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass=new  CourseClass();
	 	     courseClass.setClassName("反应训练 ");
	 	     courseClass.setCourseList(courseList);
	 	     courseClassList.add(courseClass);
	 	     
	 	  	 Map<String,Object> map2=new HashMap<String,Object>();
	 	     map2.put("type", CommCode.Course_Class16);
	 	     map2.put("reserved2", CommCode.Course_Class_type34);
	 	     List<OnlineCourse> courseList2=onlineCourseService.queryList2(map2);
	 	     
		  	    //判断是否添加到我的功夫
		 	 if(courseList2!=null&&courseList2.size()>0){
		 	    	 for(OnlineCourse onlineCourse2:courseList2){
		 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
		 	   		    reqmap.put("clientid", userid);
		 	   		    reqmap.put("courseid", onlineCourse2.getId());
		 	   		    ClientOnlineCourse clientOnlineCourse2=clientOnlineCourseMapper.selectByMap(reqmap);
		 	   		    if(clientOnlineCourse2!=null){
		 	   		    onlineCourse2.setIsAdd(true);
		 	   		    }
		 	    	 }
		 	     }
		 	 
	 	     CourseClass courseClass2=new  CourseClass();
	 	     courseClass2.setClassName("速度训练 ");
	 	     courseClass2.setCourseList(courseList2);
	 	     courseClassList.add(courseClass2);
	 	     
	 	  	 Map<String,Object> map3=new HashMap<String,Object>();
	 	     map3.put("type", CommCode.Course_Class16);
	 	     map3.put("reserved2", CommCode.Course_Class_type35);
	 	     List<OnlineCourse> courseList3=onlineCourseService.queryList2(map3);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList3!=null&&courseList3.size()>0){
	 	    	 for(OnlineCourse onlineCourse3:courseList3){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse3.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse3=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse3!=null){
	 	   		    onlineCourse3.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass3=new  CourseClass();
	 	     courseClass3.setClassName("综合反应能力 ");
	 	     courseClass3.setCourseList(courseList3);
	 	     courseClassList.add(courseClass3);
	    }
//	    if(classId==13){
//	    	 Map<String,Object> map=new HashMap<String,Object>();
//	 	     map.put("type", CommCode.Course_Class4);
//	 	     map.put("reserved2", CommCode.Course_Class_type31);
//	 	     List<OnlineCourse> courseList=onlineCourseService.queryList2(map);
//	 	     
//		 	    //判断是否添加到我的功夫
//	 	     if(courseList!=null&&courseList.size()>0){
//	 	    	 for(OnlineCourse onlineCourse:courseList){
//	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
//	 	   		    reqmap.put("clientid", userid);
//	 	   		    reqmap.put("courseid", onlineCourse.getId());
//	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
//	 	   		    if(clientOnlineCourse!=null){
//	 	   		    onlineCourse.setIsAdd(true);
//	 	   		    }
//	 	    	 }
//	 	     }
//	 	     
//	 	     CourseClass courseClass=new  CourseClass();
//	 	     courseClass.setClassName("邹市明“海盗式”教学 ");
//	 	     courseClass.setCourseList(courseList);
//	 	     courseClassList.add(courseClass);
//	 	     
//	 	  	 Map<String,Object> map2=new HashMap<String,Object>();
//	 	     map2.put("type", CommCode.Course_Class4);
//	 	     map2.put("reserved2", CommCode.Course_Class_type32);
//	 	     List<OnlineCourse> courseList2=onlineCourseService.queryList2(map2);
//	 	     
//		  	    //判断是否添加到我的功夫
//		 	 if(courseList2!=null&&courseList2.size()>0){
//		 	    	 for(OnlineCourse onlineCourse2:courseList2){
//		 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
//		 	   		    reqmap.put("clientid", userid);
//		 	   		    reqmap.put("courseid", onlineCourse2.getId());
//		 	   		    ClientOnlineCourse clientOnlineCourse2=clientOnlineCourseMapper.selectByMap(reqmap);
//		 	   		    if(clientOnlineCourse2!=null){
//		 	   		    onlineCourse2.setIsAdd(true);
//		 	   		    }
//		 	    	 }
//		 	     }
//		 	 
//	 	     CourseClass courseClass2=new  CourseClass();
//	 	     courseClass2.setClassName("方便「侧踹腿」绝杀教学 ");
//	 	     courseClass2.setCourseList(courseList2);
//	 	     courseClassList.add(courseClass2);
//	    }
	    if(classId==14){
	    	 Map<String,Object> map=new HashMap<String,Object>();
	 	     map.put("type", CommCode.Course_Class5);
	 	     map.put("reserved2", CommCode.Course_Class_type36);
	 	     List<OnlineCourse> courseList=onlineCourseService.queryList2(map);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList!=null&&courseList.size()>0){
	 	    	 for(OnlineCourse onlineCourse:courseList){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass=new  CourseClass();
	 	     courseClass.setClassName("跑步伴侣");
	 	     courseClass.setCourseList(courseList);
	 	     courseClassList.add(courseClass);
	 	     
	 	  	 Map<String,Object> map2=new HashMap<String,Object>();
	 	     map2.put("type", CommCode.Course_Class5);
	 	     map2.put("reserved2", CommCode.Course_Class_type40);
	 	     List<OnlineCourse> courseList2=onlineCourseService.queryList2(map2);
	 	     
		  	    //判断是否添加到我的功夫
		 	 if(courseList2!=null&&courseList2.size()>0){
		 	    	 for(OnlineCourse onlineCourse2:courseList2){
		 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
		 	   		    reqmap.put("clientid", userid);
		 	   		    reqmap.put("courseid", onlineCourse2.getId());
		 	   		    ClientOnlineCourse clientOnlineCourse2=clientOnlineCourseMapper.selectByMap(reqmap);
		 	   		    if(clientOnlineCourse2!=null){
		 	   		    onlineCourse2.setIsAdd(true);
		 	   		    }
		 	    	 }
		 	     }
		 	 
	 	     CourseClass courseClass2=new  CourseClass();
	 	     courseClass2.setClassName("无氧特训跑 ");
	 	     courseClass2.setCourseList(courseList2);
	 	     courseClassList.add(courseClass2);
	 	     
	 	  	 Map<String,Object> map3=new HashMap<String,Object>();
	 	     map3.put("type", CommCode.Course_Class5);
	 	     map3.put("reserved2", CommCode.Course_Class_type39);
	 	     List<OnlineCourse> courseList3=onlineCourseService.queryList2(map3);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList3!=null&&courseList3.size()>0){
	 	    	 for(OnlineCourse onlineCourse3:courseList3){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse3.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse3=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse3!=null){
	 	   		    onlineCourse3.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass3=new  CourseClass();
	 	     courseClass3.setClassName("有氧特训跑 ");
	 	     courseClass3.setCourseList(courseList3);
	 	     courseClassList.add(courseClass3);
	    }
	    
	    if(classId==15){
	    	 Map<String,Object> map=new HashMap<String,Object>();
	 	     map.put("type", CommCode.Course_Class6);
	 	     map.put("reserved2", CommCode.Course_Class_type42);
	 	     List<OnlineCourse> courseList=onlineCourseService.queryList2(map);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList!=null&&courseList.size()>0){
	 	    	 for(OnlineCourse onlineCourse:courseList){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass=new  CourseClass();
	 	     courseClass.setClassName("跳绳");
	 	     courseClass.setCourseList(courseList);
	 	     courseClassList.add(courseClass);
	 	     
	 	  	 Map<String,Object> map2=new HashMap<String,Object>();
	 	     map2.put("type", CommCode.Course_Class6);
	 	     map2.put("reserved2", CommCode.Course_Class_type41);
	 	     List<OnlineCourse> courseList2=onlineCourseService.queryList2(map2);
	 	     
		  	    //判断是否添加到我的功夫
		 	 if(courseList2!=null&&courseList2.size()>0){
		 	    	 for(OnlineCourse onlineCourse2:courseList2){
		 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
		 	   		    reqmap.put("clientid", userid);
		 	   		    reqmap.put("courseid", onlineCourse2.getId());
		 	   		    ClientOnlineCourse clientOnlineCourse2=clientOnlineCourseMapper.selectByMap(reqmap);
		 	   		    if(clientOnlineCourse2!=null){
		 	   		    onlineCourse2.setIsAdd(true);
		 	   		    }
		 	    	 }
		 	     }
		 	 
	 	     CourseClass courseClass2=new  CourseClass();
	 	     courseClass2.setClassName("哑铃 ");
	 	     courseClass2.setCourseList(courseList2);
	 	     courseClassList.add(courseClass2);
	 	     
	 	  	 Map<String,Object> map3=new HashMap<String,Object>();
	 	     map3.put("type", CommCode.Course_Class6);
	 	     map3.put("reserved2", CommCode.Course_Class_type43);
	 	     List<OnlineCourse> courseList3=onlineCourseService.queryList2(map3);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList3!=null&&courseList3.size()>0){
	 	    	 for(OnlineCourse onlineCourse3:courseList3){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse3.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse3=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse3!=null){
	 	   		    onlineCourse3.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass3=new  CourseClass();
	 	     courseClass3.setClassName("悬挂式训练带 ");
	 	     courseClass3.setCourseList(courseList3);
	 	     courseClassList.add(courseClass3);
	    }
	    
	    if(classId==16){
	    	 Map<String,Object> map=new HashMap<String,Object>();
	 	     map.put("type", CommCode.Course_Class7);
	 	     map.put("reserved2", CommCode.Course_Class_type37);
	 	     List<OnlineCourse> courseList=onlineCourseService.queryList2(map);
	 	     
		 	    //判断是否添加到我的功夫
	 	     if(courseList!=null&&courseList.size()>0){
	 	    	 for(OnlineCourse onlineCourse:courseList){
	 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
	 	   		    reqmap.put("clientid", userid);
	 	   		    reqmap.put("courseid", onlineCourse.getId());
	 	   		    ClientOnlineCourse clientOnlineCourse=clientOnlineCourseMapper.selectByMap(reqmap);
	 	   		    if(clientOnlineCourse!=null){
	 	   		    onlineCourse.setIsAdd(true);
	 	   		    }
	 	    	 }
	 	     }
	 	     
	 	     CourseClass courseClass=new  CourseClass();
	 	     courseClass.setClassName("热身激活训练 ");
	 	     courseClass.setCourseList(courseList);
	 	     courseClassList.add(courseClass);
	 	     
	 	  	 Map<String,Object> map2=new HashMap<String,Object>();
	 	     map2.put("type", CommCode.Course_Class7);
	 	     map2.put("reserved2", CommCode.Course_Class_type38);
	 	     List<OnlineCourse> courseList2=onlineCourseService.queryList2(map2);
	 	     
		  	    //判断是否添加到我的功夫
		 	 if(courseList2!=null&&courseList2.size()>0){
		 	    	 for(OnlineCourse onlineCourse2:courseList2){
		 	    		Map<String, Object> reqmap = new HashMap<String, Object>();
		 	   		    reqmap.put("clientid", userid);
		 	   		    reqmap.put("courseid", onlineCourse2.getId());
		 	   		    ClientOnlineCourse clientOnlineCourse2=clientOnlineCourseMapper.selectByMap(reqmap);
		 	   		    if(clientOnlineCourse2!=null){
		 	   		    onlineCourse2.setIsAdd(true);
		 	   		    }
		 	    	 }
		 	     }
		 	 
	 	     CourseClass courseClass2=new  CourseClass();
	 	     courseClass2.setClassName("恢复再生训练 ");
	 	     courseClass2.setCourseList(courseList2);
	 	     courseClassList.add(courseClass2);
	    }
     
		
        resPara.setCourseClassList(courseClassList);
		resPara.setCode(CommCode.M_Y000000);
		resPara.setMessage(CommCode.M_Y000001);

	    
	} catch (Exception e) {
	    resPara.setCode(CommCode.M_A000000);
	    resPara.setMessage(CommCode.M_SYS0001);

	    logger.error("doPost error: ", e);
	}
	try {
	    response.setContentType("application/json;charset=utf-8");
	    response.setHeader("pragma", "no-cache");
	    response.setHeader("cache-control", "no-cache");

	    Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss")
		    .excludeFieldsWithoutExposeAnnotation().serializeNulls()
		    .create();
	    String jsonResult = gson.toJson(resPara);

	//    logger.info("CourseListServlet jsonResult: " + jsonResult);

	    PrintWriter out = response.getWriter();
	    out.print(jsonResult);
	    out.flush();
	    out.close();

	//    logger.info("doPost end run(s): "+ DateUtil.calLastedTime(startDate));
	} catch (Exception e) {
	    resPara.setCode(CommCode.M_A000000);
	    resPara.setMessage(CommCode.M_SYS0003);

	    logger.error("doPost error: ", e);
	}
    }

    @Override
    public OnlineCourseListReqPara getReqPara(HttpServletRequest request) {

    	OnlineCourseListReqPara reqPara = null;

	try {
	    BaseRequest baseRequest = RequestUtils.getRequestPara(request,
		    new OnlineCourseListReqPara());

	    reqPara = (OnlineCourseListReqPara) baseRequest.clone();

	    String userid = request.getParameter("userid");
	    String classId = request.getParameter("classId");

//	    logger.info("reqPara userid: " + userid);
//	    logger.info("reqPara classId: " + classId);

	    reqPara.setUserid(userid);
	    reqPara.setClassId(classId);

	} catch (Exception e) {
	    logger.error("getReqPara error: ", e);
	}
	return reqPara;
    }

    @Override
    public boolean isCheckField(BaseRequest reqPara, BaseResponse resPara) {
	boolean flag = false;

	OnlineCourseListResPara cgResPara = (OnlineCourseListResPara) resPara;

	if (StringUtils.isEmpty(reqPara.getUserid())) {
	    cgResPara.setCode(CommCode.M_A000000);
	    cgResPara.setMessage(CommCode.M_P000002);
	} else {
	    flag = true;
	}
	return flag;
    }
}
